﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Sector7.Framework.Core;
using Sector7.Framework.DataDictionary.CORS;
using Sector7.Framework.Enums;

namespace Sector7.Framework.DataDictionary.Windows
{
    /// <summary>
    /// AddPrimaryKeyWindow.xaml 的交互逻辑
    /// </summary>
    public partial class AddPrimaryKeyWindow : AddModeWindowBase
    {
        public AddPrimaryKeyWindow()
        {
            InitializeComponent();
        }

        public string ColumnName
        {
            get { return m_ColumnName; }
            set { m_ColumnName = value; }
        }

        public S7_Metadata Metadata
        {
            get { return m_entity as S7_Metadata; }
            set { m_entity = value; }
        }

        protected override void InitializeForUpdating()
        {
            this.txbColumnName.Text = m_ColumnName;
            //base.InitializeForUpdating();
        }

        protected override void AddData()
        {
            Metadata = new S7_Metadata();
            Metadata.isAuto = (bool)ckbIsAuto.IsChecked;
            Metadata.KeyType = Convert.ToInt32(DBFieldType.PrimaryKey);

            base.AddData();
        }

        private string m_ColumnName = ""; 
    }
}
